<template>
  <div class="a">
    a position: absolute;
    <h2>{{ status }}</h2>
  </div>
</template>

<script>
import getData from 'api/getData'
export default {
  data () {
    return {
      status: []
    }
  },
  beforeRouteEnter (to, from, next) { // 获取完数据跳转
    getData().then((data) => {
      next(vm => {
        vm.status = 2
      })
    })
  },
  created () { // 跳转或获取数据
    // getData().then((data) => {
    //   this.status = data
    // })
  }
}
</script>

<style lang="scss" scoped>
 .a {
   background: cyan;
 }
</style>
